class Person {
  name: String
}

res1 = let (x = 1) new { name = "Pigeon" }

res2: Person = let (x = 1) new { name = "Pigeon" }

local localProperty: Person = let (x = 1) new { name = "Pigeon" }
res3 = localProperty

dynamic {
  res4 = let (x = 1) new { name = "Pigeon" }

  local localDynamic: Person = let (x = 1) new { name = "Pigeon" }
  res5 = localDynamic

  let (x = 1) new { name = "Pigeon" }

  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}

open class Company {
  ceo: Person = let (x = 1) new { name = "Pigeon" }
}

class MyCompany extends Company {
  ceo = let (x = 1) new { name = "Pigeon" }
}

res6 = new Company {}

res7 = new MyCompany {}

res8 = new Company {
  ceo = let (x = 1) new { name = "Pigeon" }
}

res9 = new MyCompany {
  ceo = let (x = 1) new { name = "Pigeon" }
}

res10 = new Listing {
  let (x = 1) new { name = "Pigeon" }
}
res11 = (res10) {
  [0] = let (x = 1) new { name = "Pigeon" }
}

res12: Listing<Person> = new {
  let (x = 1) new { name = "Pigeon" }
}
res13 = (res12) {
  [0] = let (x = 1) new { name = "Pigeon" }
}

local localListing: Listing<Person> = new {
  let (x = 1) new { name = "Pigeon" }
}
res14 = localListing
res15 = (res14) {
  [0] = let (x = 1) new { name = "Pigeon" }
}

res16 = new Mapping {
  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}
res17 = (res16) {
  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}

res18: Mapping<String, Person> = new {
  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}
res19 = (res18) {
  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}

local localMapping: Mapping<String, Person> = new {
  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}
res20 = localMapping
res21 = (res20) {
  ["Pigeon"] = let (x = 1) new { name = "Pigeon" }
}

// not yet implemented
//res22 = let (x = 1) let (x = new { name = "Pigeon" }) x
//res23 = let (x = 1) let (x: Person = new { name = "Pigeon" }) x

res24 = f1("Pigeon")
res24b = res24 is Person
res25 = f2("Pigeon")
res25b = res25 is Person
res26 = new X {}.f1("Pigeon")
res26b = res26 is Person
res27 = new X {}.f2
res27b = res27 is Person
res28 = one.two.f1
res28b = res28 is Person
res29 = f3("Pigeon")
res29b = res29 is Dynamic
res30 = new Person2 {}.friend
res30b = res30 is Dynamic

function f1(_name): Person = let (x = 1) new { name = _name }
local function f2(_name): Person = let (x = 1) new { name = _name }

class X {
  function f1(_name): Person = let (x = 1) new { name = _name }
  local function f2(_name): Person = let (x = 1) new { name = _name }
  f2 = f2("Pigeon")
}

one {
  two {
    local function f1(_name): Person = let (x = 1) new { name = _name }
    f1 = f1("Pigeon")
  }
}

function f3(_name) = new { name = _name }

class Person2 {
  friend = new { name = "Pigeon" }
}
